package com.ww.springboot.boot.thread.study.executor;

import lombok.SneakyThrows;

import java.util.concurrent.TimeUnit;

/**
 * todo
 *
 * @author wanwei
 * @since 2021-04-20 14:07
 */
public class ThreadDemo implements Runnable {

    public static int total = 0;

    public static Object sync = new Object();

    @SneakyThrows
    @Override
    public void run() {
        System.out.println(Thread.currentThread() + " 启动");
        synchronized (sync){
            total++;
        }
        System.out.println(Thread.currentThread() + " 结束");
    }
}
